# 读取excel测试用例
from openpyxl import load_workbook


class ReadExcel:
    # 读取数据
    def getData(self, excelName, sheetName):
        # 打开表格
        wb = load_workbook(f'./data/{excelName}.xlsx')

        # 指定sheet
        ws = wb[sheetName]

        # 读取出的数据格式[['',''],[],[]]
        rows = ws.max_row
        cols = ws.max_column

        info_list = []
        for r in range(2, rows + 1):
            # 定义一个列表，用来存储一行的数据
            lines = []
            for c in range(2, cols + 1):
                # 读取数据
                lines.append(ws.cell(r, c).value)

            info_list.append(lines)

        return info_list